package fr.tm.ima.client.gxt.grid.model;

/**
 * @author aquinault
 */

import java.util.ArrayList;
import java.util.List;

import org.puremvc.java.multicore.patterns.proxy.Proxy;
import com.extjs.gxt.ui.client.data.ModelData;
import fr.tm.ima.client.gxt.grid.GridFacade;


/**
 * Model data proxy.
 */
public class ModelDataProxy extends Proxy {

	/**
	 * Proxy name.
	 */
	public static final String NAME = "DataProxy";


	/**
	 * Constructor.
	 */
	public ModelDataProxy() {
		super(NAME, new ArrayList<ModelData>() );
	}

	/**
	 * Get the inner data. 
	 * @return the list in the right type.
	 */
	protected List<ModelData> getInnerData() {
		return (List<ModelData>)getData();
	}
	
	/**
	 * Store the data. 
	 * @param list the data
	 */
	public void storeData(List<ModelData> list) {
		getInnerData().addAll(list);
		sendNotification(GridFacade.MODEL_CHANGED, getInnerData());
	}
	
}
